package com.zhiy.com.estation.ui.fragment.find.back.password;

import com.zhiy.com.estation.api.ApiResult;
import com.zhiy.com.estation.model.User;

import io.reactivex.functions.Consumer;

/**
 * Created by Zyh on 2016/12/3.
 */
public class FindPassPresenter extends FindPassContract.Presenter {
    @Override
    public void findPassword(String name) {
        model.findBacPass(name)
                .subscribe(new Consumer<ApiResult<User>>() {
                    @Override
                    public void accept(ApiResult<User> userApiResult) throws Exception {
                        String msg=userApiResult.getMsg();
                        view.showMsg(msg);
                        if (userApiResult.getCode()==0){
                            view.isSuccess(userApiResult.getData());
                        }else {
                            view.isFailure();
                        }
                    }
                });

    }
}
